package edu.hd4ic.gui.controlls;

import javax.swing.*;
import java.awt.*;
import java.io.Serializable;

/**
 * @author morfant
 */
public class IconWithDescription implements Icon, Serializable {

    private Icon icon;
    private String description;

    public IconWithDescription(Icon icon,String description){
        this.icon=icon;
        this.description=description;
    }

    public String getDescription(){
        return description;
    }

    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
        icon.paintIcon(c,g,x,y);
    }

    @Override
    public int getIconWidth() {
        return icon.getIconWidth();
    }

    @Override
    public int getIconHeight() {
        return icon.getIconHeight();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final IconWithDescription other = (IconWithDescription) obj;
        if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 83 * hash + (this.description != null ? this.description.hashCode() : 0);
        return hash;
    }
        
}
